Escapes cmd.exe Special Characters#5030
Merged
myurasov-nv merged 2 commits intoisaac-sim:developfrom Mar 16, 2026
Merged
Conversation
Contributor
Greptile SummaryThis PR fixes a Windows-specific bug where
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["run_command(cmd, ...)"] --> B{"cmd is list/tuple<br>AND is_windows()?"}
B -- No --> F["subprocess.run(cmd, ...)"]
B -- Yes --> C["_escape_for_cmd_exe(cmd)"]
C --> D{"cmd[0] ends with<br>.bat or .cmd?"}
D -- No --> E["Return list(cmd) unchanged"]
D -- Yes --> G["Quote args with metacharacters<br>or whitespace"]
G --> H["Return joined string<br>(bypasses list2cmdline)"]
E --> F
H --> F
Last reviewed commit: 711410c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
subprocess.run()receives a list whose first element is a.batfile, Python invokescmd.exe /c "..."under the hood.subprocess.list2cmdlineexecuted down the line does not escapecmd.exespecial characters (<,>,|,&,^), so they are interpreted as shell operators, which breaks commands that utilize IsacSim'spython.batas interpreter ("C:\Users\Misha\IsaacLab\_isaac_sim\python.bat -m pip install setuptools<82.0.0"etc).run_command()now detects.bat/.cmdexecutables on Windows and converts the command list to a pre-quoted string, bypassinglist2cmdline.Type of change
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there